﻿using System;
using System.Collections.Generic;
using System.Web;
using System.Web.Services;
using Dynamo.Core.Plugins;
using Dynamo.Examples.Plugins.SimplePluginProvider;

[WebService(Namespace = "http://tempuri.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
public class Service : System.Web.Services.WebService
{
    public Service () {

        //Uncomment the following line if using designed components 
        //InitializeComponent(); 
    }

    [WebMethod]
	public string HelloWorld()
	{
		IProviderInterface piFirst = PluginManager.Instance.Get<IProviderInterface>("FirstProvider"),
							piFirst2 = PluginManager.Instance.Get<IProviderInterface>("FirstProvider"),
							piSecond = PluginManager.Instance.Get<IProviderInterface>("SecondProvider"),
							piSecond2 = PluginManager.Instance.Get<IProviderInterface>("SecondProvider");

		System.Console.WriteLine(piFirst.MethodA());
		System.Console.WriteLine(piFirst2.MethodA());
		System.Console.WriteLine(piFirst.InjectedFactory.Create(typeof(IDerivedInterfaceOne)).MethodB());
		//System.Console.WriteLine(piFirst.InjectedFactory.Create(typeof(IDerivedInterfaceTwo)).MethodB());
		System.Console.WriteLine(piFirst.InjectedObject.MethodC());
		System.Console.WriteLine(piSecond.MethodA());
		System.Console.WriteLine(piSecond2.MethodA());
		System.Console.WriteLine(piSecond.InjectedFactory.Create(typeof(IDerivedInterfaceOne)).MethodB());
		System.Console.WriteLine(piSecond.InjectedFactory.Create(typeof(IDerivedInterfaceTwo)).MethodB());
		System.Console.WriteLine(piSecond.InjectedObject.MethodC());

        return "Hello World";
    }
    
}
